<template>
	<view class="infoLish">
		<view class="date">今天</view>
		<view class="card flex" v-for="(item,index) in list" :key="index">
			<view class="time flex-center-column">
				<view>{{item.begin_time_time}}</view>
				<text>{{item.begin_time_date}}</text>
			</view>
			<view class="right">
				<view class="p user flex-between">
					<text>【车主】{{item.owner}} </text>
					<text>【余座】{{item.remain_seat}}</text>
					<image src="/static/arrow.png" mode="widthFix"></image>
				</view>
				<view class="p">
					【车型】{{item.brand}}
				</view>
				<view class="p">【地图】<text>起点距您17.7km</text></view>
				<view class="p">【路线】{{item.path}}</view>
				<view class="p">【备注】{{item.note}}</view>
				<view class="bottom flex">
					<text>￥{{item.price}}/座</text>
					<button class="flex-center" @click="yuding(item.id)">预定</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad(options) {
			uni.removeStorageSync('city')
			uni.setNavigationBarTitle({
				title:options.title
			})
			let citys =  options.title.replace(/\s*/g,"").split('——');
			this.getList(citys[0],citys[1])
		},
		methods: {
			yuding(id){
				uni.navigateTo({
					url:'/pages/index/reserve?id='+id
				})
			},
			getList(from_city,to_city){
				this.$https.get('car',{from_city,to_city}).then(res=>{
					console.log(res)
					this.list = res.list
				})
			}
		}
	}
</script>

<style lang="less">
	page{
		background: #f2f3f4;
	}
	@color: #4CD964;
	.infoLish{
		padding: 24rpx;
		.date{
			margin-bottom: 30rpx;
			font-size: 32rpx;
			color:@color;
		}
		.card{
			background: white;
			padding:0 24rpx;
			align-items: flex-start;
			margin-bottom: 24rpx;
			.time{
				font-size: 30rpx;
				width: 100rpx;
				padding-top: 20rpx;
				text-align: center;
				view{
					font-weight: bold;
					margin-bottom: 20rpx;
				}
				text{
					font-size: 26rpx;
				}
				
			}
			.right{
				width: 560rpx;
				.p{
					padding: 20rpx 0;
					line-height: 1.5;
					border-bottom: 1px dashed #eee;
					font-size: 30rpx;
					image{
						width: 34rpx;
						height:auto;
					}
				}
				.bottom{
					justify-content: flex-end;
					padding: 20rpx 0;
					button{
						margin: 0;
						font-size: 30rpx;
						padding: 0 30rpx;
						height: 60rpx;
						margin-left: 30rpx;
						background: @color;
						color:white;
					}
				}
			}
		}
	}
</style>
